package com.kitty.game.rank.model.record;

import lombok.Getter;
import lombok.Setter;

/**宠物属性排行榜记录*/
@Setter
@Getter
public class PetAttribRankRecord extends RankRecord {
    private String gid;//宠物gid
    private String name;//宠物名称
    private short level;//宠物等级
    private String roleName;//角色名称
    private int attrbValue;//属性值
    private byte type;//宠物类型
    public PetAttribRankRecord() {}

    public PetAttribRankRecord(String gid, String name, short level, String roleName, int attrbValue,byte type) {
        this.gid = gid;
        this.name = name;
        this.level = level;
        this.roleName = roleName;
        this.attrbValue = attrbValue;
        this.type = type;
    }

    @Override
    public int compareTo(RankRecord o) {
        /**按属性值从大到小排序*/
        PetAttribRankRecord other = (PetAttribRankRecord)o;
        if (attrbValue != other.getAttrbValue()) {
            return attrbValue > other.getAttrbValue() ? -1 : 1;
        }

        /**属性值一样时，就按gid排序吧，保证不是同一个宠物就好了*/
        return gid.compareTo(other.getGid());
    }
}
